home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / probots.arc / DECOY.PR < prev    next >
Text File  |  1991-04-28  |  788b  |  29 lines

  1.   PROCEDURE DECOY;
  2.  
  3.     { Based on a C-Robot By Bruce Oberleitner }
  4.  
  5.     { Decoy runs around the field, randomly }
  6.     { and randomly fires.  Decoy makes an excellent}
  7.     { practice target to test new robots. }
  8.  
  9.  
  10.     PROCEDURE go(dest_x, dest_y : Integer);
  11.       { go - go to the point specified }
  12.     VAR course     : Integer;
  13.     BEGIN 
  14.       course := Angle_To(dest_x, dest_y);
  15.       drive(course, 100);
  16.       WHILE (distance(loc_x, loc_y, dest_x, dest_y) > 100)
  17.       DO cannon(Random(360), Random(700)); {fire randomly}
  18.       drive(course, 0);
  19.       WHILE (speed > 0) DO {nothing} ;
  20.     END; 
  21.  
  22.  
  23.   BEGIN {Decoy Main}
  24.     REPEAT
  25.       go(1+Random(995), 1+Random(995)); { go somewhere in the field }
  26.     UNTIL Dead OR Winner;
  27.   END; { end of Decoy Main }
  28.  
  29.